<template>
  <section>
    <div class="block">
      <el-table 
        :data="tableData" 
        border
        fit
        stripe
        highlight-current-row
        v-loading="listLoading"

        align="right"
        style="width:100% ">

        <el-table-column 
          prop="enterIdCard" 
          label="身份证"

         >
        </el-table-column>
         <el-table-column 
          prop="enterName" 
          label="姓名"
         >
        </el-table-column>
        <el-table-column 
          prop="enterAddress" 
          label="地址" 
          show-overflow-tooltip
          >
        </el-table-column>
 <el-table-column 
          prop="enterCheckStringState" 
          label="审核状态" 
          >
        </el-table-column>
        <el-table-column label="操作" 
       >
          <template scope="scope">
            <el-button size="small" type="text" @click="handleMore(scope.$index, scope.row)">详情</el-button>
          </template>
        </el-table-column>
        <el-table-column label="操作" 
       >
          <template scope="scope">
            <el-button size="small"  @click="aaaaaa(scope.$index, scope.row)">通过</el-button>
              <el-button size="small"  @click="bbbbbb(scope.$index, scope.row)">未通过</el-button>
          </template>
        </el-table-column>
      </el-table>
        <!--工具条(分页)-->
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="10"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total">
          </el-pagination>
        </div>
          <!--卡号信息详情界面-->
        <cardinfo ref="cardinfo"></cardinfo>
    </section>
  </template>

<script>
  
  import util from '../../../common/js/util'
	import constant from '../../../common/js/constant'
  import { getCheckQueryStudent,pass,getCheckQueryStudentMessageCheck,saveInformation} from '../../../api/api'
  import Cardinfo from '../../../components/queryStudentMessage.vue'
	import BatchActive from '../../../components/batch_active.vue'

  export default {
      components: {
			cardinfo: Cardinfo		
  		}, 
    data() {
      return {


        filters: {
					name: ''
				},
        tableData: [],
				total: 100,//列表总条数
				pageSize:10,//每页条数
				currentPage:1,//当前页码
				listLoading: false,
        params:[],
       
      }
    },
       methods: {
         handleSizeChange(val) {
            this.pageSize = val;
            this.getaaaaa();
             this.getbbbbb();
        },
        handleCurrentChange(val) {
            this.currentPage = val;
            this.getaaaaa();
            this.getbbbbb();
        },

    
         getaaaaa: function(){
           let para = {
            currentPage:this.currentPage,
            pageSize:this.pageSize,
          }; 
				getCheckQueryStudent(para).then((res) => {
          this.total = res.resData.total;
					this.tableData = res.resData.list;
          this.listLoading = false;
					//NProgress.done();
				});
        },
           getbbbbb: function(){
               let para = {
                   currentPage:this.currentPage,
                   pageSize:this.pageSize,
               };
               getCheckQueryStudent(para).then((res) => {
                   this.total = res.resData.total;
               this.tableData = res.resData.list;
               this.listLoading = false;
               //NProgress.done();
           });
           },
        //显示卡号详细界面
			handleMore: function (index, row) {
				 this.$refs.cardinfo.showCardDetail(row);
			},
      aaaaaa: function (index, row) {
          this.$confirm('确定通过？','提示',{
              confirmButtonText:'确定',
              cancelButtonText:'取消',
              type:'warning'
          }).then(()=>{
              let para = {
                  enterId:row.enterId,
                  enterCheckState:1
              }
              pass(para).then((res) => {
              if(res===1){
              this.$message({
                  type:'success',
                  message:'审核通过！'
              });
              let params ={
                  enterId:row.enterId,

              }
              saveInformation(params).then((res)=>{

              });

           this.tableData.splice(index,1);


          }else{
              this.$message({
                  type:'error',
                  message:'操作失败'
              });
          }
          }).catch(()=>{
              this.$message({
              type:'info',
              message:'已取消'
          });
          });


				});
			},
           bbbbbb: function (index, row) {
               this.$confirm('确定让其不通过？','提示',{
                   confirmButtonText:'确定',
                   cancelButtonText:'取消',
                   type:'warning'
               }).then(()=>{
                   let parr = {
                       enterId:row.enterId,
                       enterDelete:0
                   }
                   getCheckQueryStudentMessageCheck(parr).then((res) => {
                    if(res===1){
                   this.$message({
                       type:'success',
                       message:'操作成功'
                   });
                   this.tableData.splice(index,1);
               }else {
                   this.$message({
                       type:'error',
                       message:'操作失败'
                   });
               }
               }).catch(()=>{
                   this.$message({
                   type:'info',
                   message:'已取消'
               });
           });
               });

           },

    },
    mounted(){
        this.getaaaaa();
        this.getbbbbb();
     }
  }
</script>